home *** CD-ROM | disk | FTP | other *** search
- #!/bin/csh -f
- #
- # Script to check up on a host's ipServer, and restart it if needed
- #
- set pid=`ps -ad | egrep ipServer | awk '{print $1}'`
- if (X$pid == "X") then
- # see if it went away completely.
- set pid=`ps -a | egrep ipServer | sed '/egrep/d' | awk '{print $1}'`
- if (X$pid != "X") then
- exit
- endif
- endif
-
- set host=`hostname`
-
- echo "IPSERVER found DEAD at `date`" > /dev/syslog
- set clients=`ps | egrep 'nfsmount|portmap|unfsd|sendmail|inetd|bootp|lpd' | sed '/egrep/d' | awk '{print $1}'`
- echo "Killing ipServer $pid and clients $clients" > /dev/syslog
- kill -KILL $clients
- kill -KILL $pid
-
- echo "Restarting ipServer and its clients" > /dev/syslog
- if (-e /hosts/$host/restartservers) then
- /hosts/$host/restartservers >& /dev/syslog
- else
- /sprite/admin/scripts/startClientServers >& /dev/syslog
- endif
-
- if ($#argv > 0) then
- echo "IPServer on $host died and was restarted" | mail spriters
- endif
-